package com.smart.manager.member.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.smart.common.entities.ajax.AjaxResult;
import com.smart.common.entities.constant.SmartConstant;
import com.smart.common.entities.core.Page;
import com.smart.manager.member.entities.bodys.RMemberMaterialPigUse;
import com.smart.manager.member.entities.models.MemberMaterialPigUse;
import com.smart.manager.member.repository.MemberMaterialPigUseRepository;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @author leo
 * @date 2023/10/04
 */
@Api(tags = "猪仔使用记录")
@RestController
@RequestMapping(SmartConstant.MANAGER_API_PREFIX + "member/material/pigUse")
@RequiredArgsConstructor
public class MaterialUseApi {

    private final MemberMaterialPigUseRepository memberMaterialPigUseRepository;

    @GetMapping(value = "pageList")
    @ApiOperation(value = "查询记录")
    @SaCheckPermission("member:material:PigUse:pageList")
    public AjaxResult<Page<MemberMaterialPigUse>> pageList(@Validated RMemberMaterialPigUse.SearchBody body) {
        Page<MemberMaterialPigUse> result = memberMaterialPigUseRepository.pageList(body);
        return AjaxResult.data(result);
    }

}
